<template>
  <div class="header">
    <div class="header-top">
      <div class="header-wrap">
        <p class="header-user">
          <span>尚品汇</span>
          <span>
            你好，请
            <NuxtLink to="/login">登录</NuxtLink>
            <NuxtLink to="/register">免费注册</NuxtLink>
          </span>
        </p>
        <ul class="header-nav">
          <li>
            <NuxtLink to="/">我的订单</NuxtLink>
          </li>
          <li>
            <NuxtLink to="/">我的购物车</NuxtLink>
          </li>
          <li>
            <NuxtLink to="/">我的尚品汇</NuxtLink>
          </li>
          <li>
            <NuxtLink to="/">企业采购</NuxtLink>
          </li>
          <li><NuxtLink to="/">商家服务</NuxtLink></li>
          <li><NuxtLink to="/">网站导航</NuxtLink></li>
          <li><NuxtLink to="/">手机尚品汇</NuxtLink></li>
          <li><NuxtLink to="/">网站无障碍</NuxtLink></li>
        </ul>
      </div>
    </div>
    <div class="header-bottom">
      <div class="header-wrap">
        <NuxtLink to="/">
          <img src="~/assets/imgs/Logo.png" alt="logo" />
        </NuxtLink>

        <form @submit.prevent="search">
          <input type="text" class="header-search" />
          <button class="header-search-btn">搜索</button>
        </form>
      </div>
    </div>
  </div>
</template>

<script lang="ts">
export default {
  name: "Header",
};
</script>

<script lang="ts" setup>
const search = () => {
  navigateTo("/search");
};
</script>

<style scoped lang="scss">
.header {
  height: 100px;
}

.header-top {
  height: 29px;
  background-color: $bg-color;
  line-height: 29px;
  border-bottom: 1px solid $border-color-1;
}

.header-wrap {
  display: flex;
  justify-content: space-between;
  width: 1200px;
  margin: 0 auto;
}

.header-nav {
  display: flex;
  li {
    position: relative;
    margin-left: 10px;
    margin-right: 10px;
    &::before {
      content: "";
      position: absolute;
      left: -10px;
      top: 10px;
      width: 1px;
      height: 10px;
      background-color: $border-color-2;
    }
    &:first-child::before {
      display: none;
    }
    &:last-child {
      margin-right: 0;
    }
  }
}

.header-bottom {
  height: 70px;
  .header-wrap {
    align-items: center;
    height: 100%;
  }
}

.header-search {
  width: 450px;
  height: 30px;
  outline: none;
  border: 2px solid #e2231a;
  padding: 0 10px;
}

.header-search-btn {
  background-color: #e2231a;
  width: 80px;
  height: 34px;
  border: none;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
</style>
